/**
 * Notes: 客户实体
 * Ver : CCMiniCloud Framework 2.0.1 ALL RIGHTS RESERVED BY cclinux0730 (wechat)
 * Date: 2024-03-10 19:20:00 
 */

const BaseProjectModel = require('../config/models_config').base_project_model;

class CustomerModel extends BaseProjectModel {

}

// 集合名
CustomerModel.CL = BaseProjectModel.C('oa_customer');

CustomerModel.DB_STRUCTURE = {
    _pid: 'string|true',
    CUSTOMER_ID: 'string|true',

    CUSTOMER_NAME: 'string|true|comment=客户名称',
    CUSTOMER_CODE: 'string|false|comment=客户编码',
    CUSTOMER_INDUSTRY: 'string|false|comment=所属行业',
    CUSTOMER_SCALE: 'int|false|default=1|comment=规模：1=小型, 2=中型, 3=大型',
    CUSTOMER_ADDRESS: 'string|false|comment=地址',
    CUSTOMER_WEBSITE: 'string|false|comment=网站',
    CUSTOMER_STATUS: 'int|true|default=1|comment=状态：0=潜在, 1=正式, 2=流失',
    CUSTOMER_LEVEL: 'int|false|default=3|comment=等级：1-5，表示重要性',
    CUSTOMER_TAGS: 'array|true|default=[]|comment=标签数组',
    CUSTOMER_SOURCE: 'int|false|default=1|comment=来源：1=自主开发, 2=合作伙伴, 3=营销活动',
    CUSTOMER_DESCRIPTION: 'string|false|comment=描述',
    
    CUSTOMER_OWNER_ID: 'string|false|comment=负责人ID',
    CUSTOMER_TEAM_MEMBER_IDS: 'array|true|default=[]|comment=团队成员ID数组',
    CUSTOMER_LAST_CONTACT_TIME: 'int|false|comment=最后联系时间',
    
    CUSTOMER_ADD_USER_ID: 'string|false|comment=创建人ID',
    CUSTOMER_ADD_TIME: 'int|true',
    CUSTOMER_EDIT_TIME: 'int|true',
    CUSTOMER_ADD_IP: 'string|false',
    CUSTOMER_EDIT_IP: 'string|false',
};

// 字段前缀
CustomerModel.FIELD_PREFIX = "CUSTOMER_";

/**
 * 状态：0=潜在, 1=正式, 2=流失
 */
CustomerModel.STATUS = {
    POTENTIAL: 0,
    FORMAL: 1,
    LOST: 2
};

CustomerModel.STATUS_DESC = {
    POTENTIAL: '潜在客户',
    FORMAL: '正式客户',
    LOST: '流失客户'
};

/**
 * 规模：1=小型, 2=中型, 3=大型
 */
CustomerModel.SCALE = {
    SMALL: 1,
    MEDIUM: 2,
    LARGE: 3
};

CustomerModel.SCALE_DESC = {
    SMALL: '小型',
    MEDIUM: '中型',
    LARGE: '大型'
};

/**
 * 来源：1=自主开发, 2=合作伙伴, 3=营销活动
 */
CustomerModel.SOURCE = {
    SELF: 1,
    PARTNER: 2,
    MARKETING: 3
};

CustomerModel.SOURCE_DESC = {
    SELF: '自主开发',
    PARTNER: '合作伙伴',
    MARKETING: '营销活动'
};

module.exports = CustomerModel; 